package com.keyue;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.keyue.common.directory.Path;
import com.keyue.common.utils.SpringContextHolder;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author: xms
 * @description: 管理后台启动
 * @date: 2023/3/29 18:00
 * @version: 1.0
 */
@EnableAsync
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.keyue"})
@MapperScan("com.keyue.**.mapper")
@EnableScheduling
@EnableTransactionManagement
@EnableSwagger2
public class AdminApplication {

    private static void setLogPath() {
        String appPath = Path.getAppPath(AdminApplication.class);
        System.setProperty("logging.path", appPath);
    }

    @Bean
    public SpringContextHolder springContextHolder() {
        return new SpringContextHolder();
    }

    public static void main(String[] args) {
        setLogPath();
        SpringApplication.run(AdminApplication.class, args);
    }
}
